// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Modal from '@/components/Modal'
import ModalForm from '@/components/ModalForm'
import PreviewImage from '@/components/PreviewImage'
import Search from '@/components/Search'
import Tables from '@/components/Tables/index.vue'
import UploadImage from '@/components/UploadImage'
import ProLayout, { PageHeaderWrapper } from '@ant-design-vue/pro-layout'
import hevueImgPreview from 'hevue-img-preview';
Vue.use(hevueImgPreview);
import Vue from 'vue'
import themePluginConfig from '../config/themePluginConfig'
import App from './App.vue'
import i18n from './locales'
import router from './router'
import store from './store/'
import { VueAxios } from './utils/request'

// import VueAMap from 'vue-amap'
import MapLoader from '@/utils/amap'


import socketio from 'socket.io-client'
import VueSocketIO from 'vue-socket.io'
import bootstrap from './core/bootstrap'
import './core/lazy_use' // use lazy load components
import './global.less'
import './permission' // permission control
import PrintOrder from './plugins/printOrder'
import './utils/filter' // global filter

const SocketInstance = socketio(process.env.VUE_APP_API_BASE_URL, {
    transports: ['websocket']
})
// 服务端ip地址及端口
Vue.use(
    new VueSocketIO({
        debug: process.env.NODE_ENV === 'development',
        connection: SocketInstance
    })
) //

Vue.config.productionTip = false

// mount axios to `Vue.$http` and `this.$http`
Vue.use(VueAxios)

// Vue.use(VueAMap)

// use pro-layout components
Vue.component('pro-layout', ProLayout)

Vue.component('page-container', PageHeaderWrapper)

Vue.component('page-header-wrapper', PageHeaderWrapper)

Vue.component('Tables', Tables)

Vue.component('Modal', Modal)

Vue.component('ModalForm', ModalForm)

Vue.component('Search', Search)

Vue.component('PreviewImage', PreviewImage)

Vue.component('UploadImage', UploadImage)

Vue.use(PrintOrder)

window.umi_plugin_ant_themeVar = themePluginConfig.theme

Vue.prototype.$url = process.env.VUE_APP_API_BASE_URL

// VueAMap.initAMapApiLoader({
//     key: 'YOUR_KEY',
//     plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.Driving'],
//     v: '1.4.4'
// })

MapLoader()

new Vue({
    router,
    store,
    i18n,
    // init localstorage, vuex
    created: bootstrap,
    render: h => h(App)
}).$mount('#app')
